import api from './index';

export interface Tag {
  id: string;
  name: string;
  color?: string;
  count?: number;
  createdAt: string;
  updatedAt: string;
}

// 获取标签列表
export const getTagList = () => {
  return api.get<any, Tag[]>('/tags');
};

// 获取热门标签
export const getHotTags = (limit: number = 20) => {
  return api.get<any, Tag[]>('/tags/hot', { params: { limit } });
};

// 创建标签
export const createTag = (data: Partial<Tag>) => {
  return api.post<any, Tag>('/tags', data);
};

// 更新标签
export const updateTag = (id: string, data: Partial<Tag>) => {
  return api.put<any, Tag>(`/tags/${id}`, data);
};

// 删除标签
export const deleteTag = (id: string) => {
  return api.delete<any, void>(`/tags/${id}`);
};